/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package org.apli.haiam.ejb.entidades;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author Informática
 */
@Entity
@Table(name = "adm_menu")
@NamedQueries({
    @NamedQuery(name = "AdmMenu.findAll", query = "SELECT a FROM AdmMenu a")})
public class AdmMenu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_menu")
    private Short idMenu;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 64)
    @Column(name = "clave")
    private String clave;
    @Size(max = 256)
    @Column(name = "url")
    private String url;
    @Size(max = 64)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 128)
    @Column(name = "icon")
    private String icon;
    @Size(max = 256)
    @Column(name = "tooltiptext")
    private String tooltiptext;
    @Size(max = 128)
    @Column(name = "accion")
    private String accion;
    @Column(name = "secuencia")
    private Short secuencia;
    @Column(name = "obligatorio")
    private Short obligatorio;
    @Column(name = "visible")
    private Short visible;
    @Column(name = "nivel")
    private Short nivel;
    @JoinTable(name = "adm_menu_accion", joinColumns = {
        @JoinColumn(name = "id_menu", referencedColumnName = "id_menu")}, inverseJoinColumns = {
        @JoinColumn(name = "id_accion", referencedColumnName = "id_accion")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<AdmAccion> admAccionList;
    @JoinTable(name = "adm_sistema_menu", joinColumns = {
        @JoinColumn(name = "id_menu", referencedColumnName = "id_menu")}, inverseJoinColumns = {
        @JoinColumn(name = "id_sistema", referencedColumnName = "id_sistema")})
    @ManyToMany(fetch = FetchType.LAZY)
    private List<AdmSistema> admSistemaList;
    @JoinColumn(name = "id_sistema", referencedColumnName = "id_sistema")
    @ManyToOne(fetch = FetchType.LAZY)
    private AdmSistema admSistema;
    @OneToMany(mappedBy = "admMenu", fetch = FetchType.LAZY)
    private List<AdmMenu> admMenuList;
    @JoinColumn(name = "id_submenu", referencedColumnName = "id_menu")
    @ManyToOne(fetch = FetchType.LAZY)
    private AdmMenu admMenu;

    public AdmMenu() {
    }

    public AdmMenu(Short idMenu) {
        this.idMenu = idMenu;
    }

    public AdmMenu(Short idMenu, String clave) {
        this.idMenu = idMenu;
        this.clave = clave;
    }

    public Short getIdMenu() {
        return idMenu;
    }

    public void setIdMenu(Short idMenu) {
        this.idMenu = idMenu;
    }

    public String getClave() {
        return clave;
    }

    public void setClave(String clave) {
        this.clave = clave;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getTooltiptext() {
        return tooltiptext;
    }

    public void setTooltiptext(String tooltiptext) {
        this.tooltiptext = tooltiptext;
    }

    public String getAccion() {
        return accion;
    }

    public void setAccion(String accion) {
        this.accion = accion;
    }

    public Short getSecuencia() {
        return secuencia;
    }

    public void setSecuencia(Short secuencia) {
        this.secuencia = secuencia;
    }

    public Short getObligatorio() {
        return obligatorio;
    }

    public void setObligatorio(Short obligatorio) {
        this.obligatorio = obligatorio;
    }

    public Short getVisible() {
        return visible;
    }

    public void setVisible(Short visible) {
        this.visible = visible;
    }

    public Short getNivel() {
        return nivel;
    }

    public void setNivel(Short nivel) {
        this.nivel = nivel;
    }

    public List<AdmAccion> getAdmAccionList() {
        return admAccionList;
    }

    public void setAdmAccionList(List<AdmAccion> admAccionList) {
        this.admAccionList = admAccionList;
    }

    public List<AdmSistema> getAdmSistemaList() {
        return admSistemaList;
    }

    public void setAdmSistemaList(List<AdmSistema> admSistemaList) {
        this.admSistemaList = admSistemaList;
    }

    public AdmSistema getAdmSistema() {
        return admSistema;
    }

    public void setAdmSistema(AdmSistema admSistema) {
        this.admSistema = admSistema;
    }

    public List<AdmMenu> getAdmMenuList() {
        return admMenuList;
    }

    public void setAdmMenuList(List<AdmMenu> admMenuList) {
        this.admMenuList = admMenuList;
    }

    public AdmMenu getAdmMenu() {
        return admMenu;
    }

    public void setAdmMenu(AdmMenu admMenu) {
        this.admMenu = admMenu;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idMenu != null ? idMenu.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AdmMenu)) {
            return false;
        }
        AdmMenu other = (AdmMenu) object;
        if ((this.idMenu == null && other.idMenu != null) || (this.idMenu != null && !this.idMenu.equals(other.idMenu))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.apli.haiam.ejb.entidades.AdmMenu[ idMenu=" + idMenu + " ]";
    }
    
}
